

        <g:set var="entityName" value="${message(code: 'post.label', default: 'Post')}" />
            <div class="dialog">
                <table>
                    <tbody>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="post.title.label" default="Title" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: postInstance, field: "title")}</td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="post.courses.label" default="Course" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: postInstance, field: "courses")}</td>
                            
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="post.needSex.label" default="Need Sex" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: postInstance, field: "needSex")}</td>
                            
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="post.content.label" default="Content" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: postInstance, field: "content")}</td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="post.createTime.label" default="Create Time" /></td>
                            
                            <td valign="top" class="value"><g:formatDate date="${postInstance?.createTime}" format="yyyy年MM月dd日"/></td>
                            
                        </tr>    
                    </tbody>
                </table>
                <div style="height:20px;"></div>
                <table>
                    <tbody>
                        <g:each in="${postInstance.remarks}" status="i" var="remarkInstance">
                                <td>回复人:<g:link controller="teacher" action="show" id="${remarkInstance?.user?.id}">${remarkInstance?.user?.realname}|${remarkInstance?.user?.username}</g:link></td>
                                <td>标题:${remarkInstance.title}</td>
                                <td>内容:${remarkInstance.content}</td>
                                <td>
                                    <g:ifAnyGranted role="ROLE_ADMIN">
                                        <g:link action="edit" id="${remarkInstance.id}" controller="remark">修改</g:link>
                                        <g:link action="delete" id="${remarkInstance.id}"  controller="remarkMgr" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">删除</g:link>
                                     </g:ifAnyGranted>

                                     <g:if test="${remarkInstance.user.id.toString() == loggedInUserInfo(field:'id').toString()}">
                                        <g:link action="edit" id="${remarkInstance.id}" controller="remark">修改</g:link>
                                        <g:link action="delete" id="${remarkInstance.id}" params="[postId:postInstance?.id]"  controller="remarkMgr" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">删除</g:link>
                                     </g:if>
                                </td>
                                
                            </tr>
                        </g:each>
                    </tbody>
                </table>

                <g:isLoggedIn>
                <g:ifAnyGranted role="ROLE_TEACHER">
    
                <g:if test="${flash.message}">
                <div class="message">${flash.message}</div>
                </g:if>
                <h1>添加回复</h1>
                <g:form action="save" method="post" controller="remark" name="createRemark">
                    <g:hiddenField name="post.id" value="${postInstance?.id}" />
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title"><g:message code="remark.title.label" default="标题" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: remarkInstance, field: 'title', 'errors')}">
                                    <g:textField name="title" maxlength="100" value="${remarkInstance?.title}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="content"><g:message code="remarkInstance.content.label" default="内容" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: remarkInstance, field: 'content', 'errors')}">
                                    <g:textArea name="content" value="${remarkInstance?.content}" />
                                </td>
                            </tr>
                             <tr class="prop">
                                <td valign="top" colspan=2>
                                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
                                </td>
                            </tr>
                        </tbody>
                  </table>
                   
             </g:form>
             </g:ifAnyGranted>
             </g:isLoggedIn>

             <g:isNotLoggedIn>
             请<g:link controller="login" >登录</g:link>后留言
             </g:isNotLoggedIn>
            </div>
